package Interfaz;


import java.awt.BorderLayout;
import java.util.ArrayList;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;


public class NewJFrame extends javax.swing.JFrame {
    private ArrayList<String> a;
    private double peso;
    private double valor;
    private String arqueologo;
    private String pirata;
 
    public NewJFrame() {
        initComponents();
        this.setSize(503, 605);
//        int peso = 439;
//        int valor = 34000;
//        String pirata = "Mixocu";
//        String arqueologo = "Cabe";
//        ArrayList<String> a = new ArrayList<String>();
//        a.add("Ergintone");
//        a.add("Aragaey");
//        a.add("Cabe");
                
        //NewJPanel F = new NewJPanel(a, arqueologo, pirata, peso, valor);
        
        //necesita tesoros, pospirata, posarqueologo, peso, valor
        
        //this.add(F, BorderLayout.CENTER);
        this.pack();
    }
    public NewJFrame(ArrayList<String> a, String arqueologo, String pirata, int peso, int valor) {
        this.peso = peso;
        this.valor = valor;
        this.arqueologo = arqueologo;
        this.pirata = pirata;
        this.a.addAll(a);
        initComponents();
        this.setSize(503, 605);
        NewJPanel F = new NewJPanel(a, arqueologo, pirata, peso, valor);
        //F.setVisible(true);
        //F.repaint();
        this.add(F, BorderLayout.CENTER);
        this.pack();
    }
     public void actualizar(ArrayList<String> a, String arqueologo, String pirata, double peso, double valor){
        NewJPanel F = new NewJPanel(a, arqueologo, pirata, peso, valor);
        this.peso = peso;
        this.valor = valor;
        this.arqueologo = arqueologo;
        this.pirata = pirata;
        this.a = a;
        this.repaint();
        initComponents();
        
        this.setSize(503, 605);
        //NewJPanel F = new NewJPanel(a, arqueologo, pirata, peso, valor);
        F.setVisible(true);
        F.updateUI();
        F.repaint();
        
        this.add(F, BorderLayout.CENTER);
        this.pack();
        SwingUtilities.updateComponentTreeUI(this); 
        F.repaint();
    }
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 503, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 606, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new NewJFrame().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
   


}